package com.lotus.lqmp.service.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lotus.lqmp.base.biz.bean.PageQuery;
import com.lotus.lqmp.service.controller.vo.req.EcuReviewDetailExportReq;
import com.lotus.lqmp.service.controller.vo.req.ReviewPlanEcuMasterDataQueryReq;
import com.lotus.lqmp.service.controller.vo.resp.ReviewPlanEcuMasterDataResp;
import com.lotus.lqmp.service.service.ReviewPlanEcuMasterDataService;
import com.lotus.platform.common.model.base.BaseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 评审记录ECU主数据Controller
 *
 * @author Shiheng.Liu1
 * @date 2022-03-29
 */
@Api(tags = "评审记录ECU主数据")
@RestController
@RequestMapping("/api/v1/reviewPlanEcuMasterData")
public class ReviewPlanEcuMasterDataController{

    @Autowired
    private ReviewPlanEcuMasterDataService reviewPlanEcuMasterDataService;

    /**
     * Overall页面数据查询
     */
    @ApiOperation("Overall页面数据查询")
    @PostMapping("/page")
    public BaseResult<Page<ReviewPlanEcuMasterDataResp>> page(
        @RequestBody PageQuery<ReviewPlanEcuMasterDataQueryReq> pageQuery) {
        return BaseResult.ok(reviewPlanEcuMasterDataService.queryDriveLogList(pageQuery));
    }

    /**
     * Overall页面数据导出
     */
    @ApiOperation("Overall页面数据导出")
    @PostMapping("/export")
    public void export(HttpServletResponse response, @RequestBody ReviewPlanEcuMasterDataQueryReq exportReq)
        throws IOException {
        reviewPlanEcuMasterDataService.handleExportIssueRecords(response, exportReq);
    }

}
